<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:camunda="http://activiti.org/bpmn" targetNamespace="Examples"
  xmlns:tns="Examples">
  <message id="messageId" name="Message" />
  <error id="errorId" errorCode="ThrowBpmnErrorDelegate"/>

  <process id="NestedNonInterruptingMessageEventSubprocessScenarioNestedSubprocess" isExecutable="true">
    <startEvent id="theStart" />
    <sequenceFlow sourceRef="theStart" targetRef="outerSubProcess" />

    <!-- Outer embedded subprocess -->
    <subProcess id="outerSubProcess">
      <startEvent id="outerSubProcessStart"/>
      <sequenceFlow sourceRef="outerSubProcessStart" targetRef="outerSubProcessTask" />
      <userTask id="outerSubProcessTask" name="Task" />
      <sequenceFlow sourceRef="outerSubProcessTask" targetRef="outerSubProcessEnd" />
      <endEvent id="outerSubProcessEnd" />

      <!-- non-interrupting event subprocess -->
      <subProcess id="eventSubProcess" triggeredByEvent="true">
        <startEvent id="eventSubProcessStart" isInterrupting="false">
          <messageEventDefinition messageRef="messageId" />
        </startEvent>
        <sequenceFlow sourceRef="eventSubProcessStart" targetRef="eventSubProcessTask" />
        <userTask id="eventSubProcessTask" />
        <sequenceFlow sourceRef="eventSubProcessTask" targetRef="innerSubProcess" />

        <!-- inner embedded subprocess -->
        <subProcess id="innerSubProcess">
          <startEvent id="innerSubProcessStart" />
          <sequenceFlow sourceRef="innerSubProcessStart" targetRef="innerSubProcessTask" />
          <userTask id="innerSubProcessTask" name="Task" />
          <sequenceFlow sourceRef="innerSubProcessTask" targetRef="throwErrorServiceTask" />
          <serviceTask id="throwErrorServiceTask" camunda:class="org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate" />
          <sequenceFlow sourceRef="throwErrorServiceTask" targetRef="innerSubProcessEnd" />
          <endEvent id="innerSubProcessEnd" />
        </subProcess>

        <sequenceFlow sourceRef="innerSubProcess" targetRef="eventSubProcessEnd" />
        <endEvent id="eventSubProcessEnd" />
      </subProcess>
    </subProcess>

    <sequenceFlow sourceRef="outerSubProcess" targetRef="theEnd" />
    <endEvent id="theEnd" />

    <!-- Boundary event catching the error -->
    <boundaryEvent id="catchError" attachedToRef="outerSubProcess">
      <errorEventDefinition errorRef="errorId"/>
    </boundaryEvent>
    <sequenceFlow id="flow3" sourceRef="catchError" targetRef="escalatedTask" />
    <userTask id="escalatedTask" />
    <sequenceFlow id="flow5" sourceRef="escalatedTask" targetRef="escalatedEnd" />
    <endEvent id="escalatedEnd" />
  </process>
</definitions>
